// eventBus.js
window.EventBus = {
    events: {},

    on: function(eventName, fn) {
        this.events[eventName] = this.events[eventName] || [];
        this.events[eventName].push(fn);
        console.log("事件注册成功:", eventName);
    },

    emit: function(eventName, data) {
        console.log("触发事件:", eventName, data);
        if (this.events[eventName]) {
            this.events[eventName].forEach(function(fn) {
                fn(data);
            });
        } else {
            console.log("没有监听器注册此事件:", eventName);
        }
    }
};

console.log("EventBus 已初始化");
